Various websites and application systems enable users to view user-created content, where such content is often protected under privacy settings. For example, a social networking application system enables each of its users to set a privacy setting for almost every “entity” relating to the application system and to adjust the setting at any time. Example entities are photos, videos, status updates, wall posts, timeline, etc. A particular user can view any information related to entities of other users on the social networking system, as long as the privacy settings of those other users allow such viewing. The particular user can also request the information to be filtered, sorted, or organized according to a constraint (e.g., most recent). The information is generally retrieved from one or more databases of the social networking system. However, retrieving the information in compliance with the privacy settings and the various constraints can consume significant computing resources and cause a significant delay to system performance.
The queries to retrieve only the compliant information typically involve multiple back-and-forth operations, or “hops,” between a frontend server (e.g., web server) and a backend server (e.g., database server) of the social networking system. In particular, portions of the information are retrieved from one or more databases of the backend server and are returned to the frontend server for a privacy check. The frontend server stores the associated privacy settings for the portions of information and defines and/or evaluates the privacy settings for each portion being retrieved. Once all of the photos are fetched and the privacy settings for those photos are checked, the frontend server may then apply the requested constraint(s) (e.g., sort all of the friends' privacy-compliant photos according to most recent and remove old photos before returning them).
The network hops between the frontend and backend servers can consume a significant amount of time and computing resources, especially if the structure or the design of the one or more databases is not efficient for a particular type of query. Further, in an example where a large number of photos are removed from the result set, e.g., for not being recent, a substantial amount of the computing resources is wasted in the back-and-forth network hops executed to retrieve all of the photos.